package com.example.Administrator.shoujiweishi.activities;

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.FrameLayout;

import com.example.Administrator.shoujiweishi.R;
import com.example.Administrator.shoujiweishi.activities.base.BaseActivity;
import com.example.Administrator.shoujiweishi.fragments.FirstFragment;
import com.example.Administrator.shoujiweishi.fragments.TwoFragment;

public class one_key_sos extends BaseActivity {

    FrameLayout frameLayout;
    FirstFragment firstFragment;
    TwoFragment twoFragment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Toolbar toolbar= (Toolbar) findViewById(R.id.toolbar_sos);
        setSupportActionBar(toolbar);
        ActionBar actionBar=getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        frameLayout= (FrameLayout) findViewById(R.id.fl_sos);
        toolbar.setNavigationIcon(R.mipmap.back);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public int getContentXML() {
        return R.layout.activity_one_key_sos;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        if (firstFragment==null) {
            firstFragment = new FirstFragment();
        }
        getFragmentManager().beginTransaction().add(R.id.fl_sos,firstFragment).commit();
    }
    public void getFragment(){
        if (twoFragment==null) {
            twoFragment = new TwoFragment();
        }
        getFragmentManager().beginTransaction().hide(firstFragment).add(R.id.fl_sos,twoFragment).commit();
    }
}

